#ifndef BUTTON_2018
#define BUTTON_2018

#include <functional>

#include    "../uicommon/clickable.h"
#include    "../../picture/picturerenderwrap.h"
#include    "../uicommon/drawable.h"


class Button : public Clickable,public Drawable
{
public:
    Button(const char* file,GLfloat width,GLfloat height);

    //implement Clickable
    virtual ~Button() override;

private:
    SinglePictureRenderWrap* m_wrap;
    Point m_position;

public:
    std::function<void(int,int)> m_function;

public:
    virtual bool isClickArea(int x,int y) override;
    virtual void clicked(int x,int y) override;

public:
    virtual void render()override;  //Drawable
    void update();
    void RegisterCallbackFucntion(std::function<void(int,int)>& func){m_function = func;}

public:
    Point getPosition(){return m_position;}
    void setPosition(int x,int y)
    {
        m_position.x = x;
        m_position.y = y;
    }
};


#endif // BUTTON_2018
